package ar.edu.utn.frba.dds.opendesigners.user;

import java.math.BigDecimal;

import ar.edu.utn.frba.dds.opendesigners.RouteOption;
import ar.edu.utn.frba.dds.opendesigners.SearchParam;
import ar.edu.utn.frba.dds.opendesigners.SearchResponse;
import ar.edu.utn.frba.dds.opendesigners.TravelAgent;

public class Free implements SubscriptionType {
	public TravelAgent travelAgent;
	private BigDecimal surcharge;
	private BigDecimal excludedPrice;
	
	public Free(TravelAgent travelAgent, BigDecimal excludedPrice, BigDecimal surcharge) {
		this.travelAgent = travelAgent;
		this.surcharge = surcharge;
		this.excludedPrice = excludedPrice;
	}
	
	@Override
	public SearchResponse search(SearchParam searchParam) {
		return this.travelAgent.search(searchParam).filterPrice(this.excludedPrice).surchargePrice(this.surcharge());
	}

	private BigDecimal surcharge() {
		return this.surcharge;
	}
	
	@Override
	public void buy(RouteOption option){
		this.travelAgent.buy(option);
	}
	
}
